package cc.dowell.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cc.dowell.pojo.History;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface HistoryMapper extends BaseMapper<History> {

    @MapKey("d")
    List<Map<String, Integer>> getCountByMonth(@Param("year") int year, @Param("month") int month);

    @MapKey("variety_code")
    @Select("SELECT variety_code,count(1) as freq FROM t_history GROUP BY variety_code")
    List<Map<String, Integer>> getCountByVariety();

    @MapKey("variety_code")
    List<Map<String, Object>> getMatureRateByDays();

}
